<template>
<!-- 采购入仓单 -->
  <section class="content-box">
      <!--采购入仓单列表-->
      <div v-if="isshowList">
        <el-col :span="24" class="SuppC-toolbar">
          <el-form class="title">
            <div>
              <h2>采购入仓单</h2>
              <img @click="handleIn" class="SuppC-common-icon" src="../../../../static/content/images/Common/common-add.png" alt=""/>
            </div>
            <el-form-item class="cover">
              <div class="list-img" @click="search">
                <img class="SuppC-common-icon" src="../../../../static/content/images/Common/common-query.png" alt=""/>
                <span>查询</span>
              </div>
              <el-popover
                ref="poverMerge"
                placement="bottom"
                width="100"
                trigger="hover"
                :visible-arrow="false">
                <div class="item-img" @click="handlePrint()" style="display:block;float:none">
                  <img class="SuppC-common-icon" src="../../../../static/content/images/Common/common-print.png" alt=""/>
                  <span>打印</span>
                </div>
                <div class="item-img" @click="handleExport()" style="display:block;float:none">
                  <img class="SuppC-common-icon" src="../../../../static/content/images/Common/common-export.png" alt=""/>
                  <span>导出</span>
                </div>
              </el-popover>
              <div class="list-img" v-popover:poverMerge>
                <img class="SuppC-common-icon" src="../../../../static/content/images/Common/common-more.png" alt=""/>
              </div>
            </el-form-item>
          </el-form>
        </el-col>
        <!--列表-->
        <el-table v-if="dataList" 
        :data="dataList" 
        ref="multipleTable"
        @row-dblclick="handleIn" 
        tooltip-effect="dark"
        highlight-current-row  
        v-loading="loading"
        border
        element-loading-text="正在加载中"
        style="width: 100%">
          <el-table-column
            prop="A"
            label="单据日期"
            sortable
            width="150">
          </el-table-column>
          <el-table-column
            prop="B"
            label="单据编号"
            width="150"
            show-overflow-tooltip>
          </el-table-column>
          <el-table-column
            prop="C"
            label="单据名称"
            width="150"
            sortable
            show-overflow-tooltip>
          </el-table-column>
          <el-table-column
            prop="D"
            label="仓库名称"
            width="150">
          </el-table-column>
          <el-table-column
            prop="E"
            label="采购订单"
            width="150"
            >
          </el-table-column>
          <el-table-column
            prop="F"
            label="进货单标识"
            width="150">
          </el-table-column>
          <el-table-column
            prop="G"
            label="供应商"
            width="220"
            show-overflow-tooltip>
          </el-table-column>
          <el-table-column
            prop="H"
            label="状态"
            width="150">
          </el-table-column>
          <el-table-column
            label="操作">
            <template slot-scope="scope">
              <div class="list-img" @click="repeal(scope.$index, scope.row)">
                <img class="common-icon" src="../../../../static/content/images/Common/common-repeal.png" alt=""/>
              </div>
              <div class="list-img" @click="generate(scope.$index, scope.row)">
                <img class="common-icon" src="../../../../static/content/images/Common/common-generate.png" alt=""/>
              </div>
              <div class="list-img" @click="checkflowRow(scope.$index, scope.row)">
                <img class="common-icon" src="../../../../static/content/images/Common/common-flow.png" alt=""/>
              </div>
              <div class="list-img" @click="handleDel(scope.$index, scope.row)">
                <img class="common-icon" src="../../../../static/content/images/Common/common-list-dele.png" alt=""/>
              </div>
            </template>
          </el-table-column>
        </el-table>
        <!--查询-->
        <el-dialog title="查询" :visible.sync="dialogSearchVisible" :modal-append-to-body="false" size="tiny">
          <el-form :model="Searchform" class="Searform">
            <el-form-item label="单据日期" :label-width="formLabelWidth">
              <el-date-picker type="date" v-model="Searchform.StartDate" style="width:120px;" placeholder="选择日期"></el-date-picker>
              至&nbsp;<el-date-picker type="date" v-model="Searchform.EndDate" style="width:120px;" placeholder="选择日期"></el-date-picker>
            </el-form-item>
            <el-form-item label="进货单标识" :label-width="formLabelWidth">
              <el-select v-model="Searchform.DocStatus" style="width:262px;" placeholder="请选择">
                <el-option value="" label="全部">全部</el-option>
                <el-option
                  v-for="item in options"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
                </el-option>
              </el-select>
            </el-form-item>
            <el-form-item label="单据编号" :label-width="formLabelWidth">
              <el-input v-model="Searchform.DocNo" style="width:262px;"></el-input>
            </el-form-item>
            <el-form-item label="单据名称" :label-width="formLabelWidth">
              <el-select v-model="Searchform.DocStatus" style="width:262px;" placeholder="请选择">
                <el-option value="" label="全部">全部</el-option>
                <el-option
                  v-for="item in options"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
                </el-option>
              </el-select>
            </el-form-item>
            <el-form-item label="状态" :label-width="formLabelWidth">
              <el-select v-model="Searchform.DocStatus" style="width:262px;" placeholder="请选择">
                <el-option value="" label="全部">全部</el-option>
                <el-option
                  v-for="item in options"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
                </el-option>
              </el-select>
            </el-form-item>
            <el-form-item label="供应商" :label-width="formLabelWidth">
              <el-select v-model="Searchform.DocStatus" style="width:262px;" placeholder="请选择">
                <el-option value="" label="全部">全部</el-option>
                <el-option
                  v-for="item in options"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
                </el-option>
              </el-select>
            </el-form-item>
          </el-form>
          <div slot="footer" class="dialog-footer cover">
            <el-button size="small" @click="Reset">重 置</el-button>
            <el-button size="small" @click="Query">确 定</el-button>
          </div>
        </el-dialog>
      </div>
      <!--采购入仓单-->
      <div v-if="isshowIn">
        <!-- 导航条 -->
		    <div class="flex-top">
          <div>
            <i class="el-icon-arrow-left back" @click="ToBack"></i>
            <span style="font-size:20px;vertical-align:middle;margin:0 10px;">
              采购入仓{{InRadioComputed}}
            </span>
          </div>
          <!-- 右侧 -->
          <div class="flex">
            <span class="wrapper cover">
              <div style="margin:10px;overflow:hidden;">
                <div class="list-img" @click="Save()">
                  <el-tooltip class="item" effect="dark" content="保存" placement="bottom">
                    <img class="common-button-group" src="../../../../static/content/images/Common/common-save.png" alt=""/>
                  </el-tooltip>
                </div>
                <div class="list-img" @click="Submit()">
                  <el-tooltip class="item" effect="dark" content="提交" placement="bottom">
                    <img class="common-button-group" src="../../../../static/content/images/Common/common-submit.png" alt=""/>
                  </el-tooltip>
                </div>
                <div class="list-img" @click="handlePrint()">
                  <el-tooltip class="item" effect="dark" content="打印" placement="bottom">
                    <img class="common-button-group" src="../../../../static/content/images/Common/common-print.png" alt=""/>
                  </el-tooltip>
                </div>
              </div>
            </span>
          </div>
        </div>
        <div v-if="isShowRadio" v-show="inRadio === ''" class="SuppC-nav-item">
          <el-radio-group 
            v-model="inRadio" 
            @change="changeRadio(inRadio)">
            <span>
              <el-radio :label="1">订单入仓</el-radio>
            </span>
            <span style="padding-left:15px;">
              <el-radio :label="2">非订单入仓</el-radio>
            </span>
          </el-radio-group>
        </div>
        <main class="main" style="width:1120px">
          <div class="main-left">
            <div v-if="DocNo">
              <h3>单号:</h3>
              <strong>{{DocNo}}</strong>
            </div>
            <div>
              <h3>日期：</h3>
              <div class="flex">
                <el-date-picker type="date" v-model="DocDate" placeholder="选择日期">
                </el-date-picker>
              </div>
            </div>
          </div>
          <div class="main-right" style="width:65%;">
            <div class="left-form">
              <el-form label-width="70px" class="form-content">
                <el-row>
                  <el-col :span="12">
                    <el-form-item label="供应商">
                      <el-select v-model="name1" placeholder="请选择供应商" style="width:200px;">
                        <el-option
                          v-for="item in Names"
                          :key="item.value"
                          :label="item.label"
                          :value="item.value">
                        </el-option>
                      </el-select>
                    </el-form-item>
                  </el-col>
                  <el-col :span="12" v-if="inStatus==false">
                    <el-form-item label="结算方式">
                      <el-select @change="settleChange(settle)" v-model="settle" placeholder="请选择结算方式" style="width:200px;">
                        <el-option
                          v-for="item in Settlement"
                          :key="item.value"
                          :label="item.label"
                          :value="item.value">
                        </el-option>
                      </el-select>
                    </el-form-item>
                  </el-col>
                  <el-col :span="12" v-if="inStatus==true">
                    <el-form-item label="采购订单">
                      <el-input 
                      placeholder="请选择采购订单"
                      v-model="name1" 
                      style="width:200px;"
                      icon="search"
                      @focus="PurOrderQuery"
                      ></el-input>
                    </el-form-item>
                  </el-col>
                  <el-col :span="12">
                    <el-form-item label="采购员">
                      <el-input v-model="name1" placeholder="请输入采购员" style="width:200px;"></el-input>
                    </el-form-item>
                  </el-col>
                  <el-col :span="12">
                    <el-form-item label="仓库名称">
                      <el-select v-model="name1" placeholder="请选择仓库" style="width:200px;">
                        <el-option
                          v-for="item in Names"
                          :key="item.value"
                          :label="item.label"
                          :value="item.value">
                        </el-option>
                      </el-select>
                    </el-form-item>
                  </el-col>
                  <el-col :span="24">
                    <el-form-item label="业务描述">
                      <el-input
                        style="width:555px;"
                        type="textarea"
                        :rows="3"
                        placeholder="请输入内容"
                        v-model="name1">
                      </el-input>
                    </el-form-item>
                  </el-col>
                </el-row>
              </el-form>
            </div>
          </div>
        </main>
        <div class="border-solid"></div>
        <div class="budget cover" style="width:1120px;">
          <h3>入仓明细</h3>  
          <el-input
            placeholder="请输入关键字查询"
            icon="search"
            v-model="input2"
            style="width:200px;"
            size="small"
            :on-icon-click="handleIconClick">
          </el-input>
          <div class="SuppC-Nas-itemRight">
            <el-tooltip class="item" effect="dark" content="导入" placement="top-start" style="margin-right:20px;">
              <span class="SuppC-common-icon"><img src="../../../../static/content/images/Common/common-import.png" alt=""></span>
            </el-tooltip>
            <el-tooltip class="item" effect="dark" content="导出" placement="top-start">
              <span class="SuppC-common-icon" @click="handleExport"><img src="../../../../static/content/images/Common/common-export.png" alt=""></span>
            </el-tooltip>
          </div>
          <table class="InHideTable" border="1" style="width:1080px;margin:0 auto;">
            <tr>
              <th style="width:60px;">操作</th>
              <th style="width:235px;">存货编码</th>
              <th style="width:235px;">存货名称</th>
              <th :style="{width:inStatus?'180px':'100px'}" v-if="inStatus==true">订单数量</th>
              <th class="font-green" :style="{width:inStatus?'180px':'100px'}" v-if="inStatus==true">本次入仓</th>
              <th style="width:180px;" class="font-green" v-if="inStatus==false">入仓数量</th>
              <th style="width:180px;" v-if="inStatus==false">采购单价</th>
              <th style="width:180px;" class="font-green" v-if="inStatus==false">采购金额</th>
            </tr>
            <tr v-for="(item,index) in InWarehousingDetail" :key="index">
              <td>
                <span v-if="inStatus==false" class="SuppC-common-icon" @click="addInRow(index)"><!--添加入仓单-->
                  <img src="../../../../static/content/images/Common/common-add.png" alt=""/>
                </span>
                <span class="SuppC-common-icon" @click="deleInRow(index)"><!--删除入仓单当前行-->
                  <img src="../../../../static/content/images/Common/common-dele.png" alt=""/>
                </span>
              </td>
              <td @click="Stock(index,inStatus)">
                <template v-if="inStatus==false">
                  <el-input type="text" class="input-Focus"   v-model="item.A"></el-input>
                </template>
                <template v-if="inStatus==true">
                  {{item.A}}
                </template>
              </td>
              <td>
                {{item.B}}
              </td>
              <td  v-if="inStatus==true">
                {{item.C}}
              </td>
              <td v-if="inStatus==true">
                <el-input :ref="index * 2 + 1" @keyup.enter.native="jump(index * 2 + 1)" type="text" class="input-Focus white" v-model="item.D"></el-input>
              </td>
              <td v-if="inStatus==false">
                <el-input :ref="index * 2 + 2" @keyup.enter.native="jump(index * 2 + 2)" placeholder="请录入" type="text" class="input-Focus white" v-model="item.E"></el-input>
              </td>
              <td v-if="inStatus==false">
                {{item.F}}
              </td>
              <td v-if="inStatus==false">
                <el-input :ref="index * 2 + 3" @keyup.enter.native="jump(index * 2 + 3)" placeholder="请录入" type="text" class="input-Focus white" v-model="item.G"></el-input>
              </td>
            </tr>
            <tr v-if="inStatus==false">
              <td colspan="5">合计：</td>
              <td>{{PurAmountCompute}}</td><!--采购金额-->
            </tr>
          </table>
        </div>
      </div>
      <!-- 采购订单弹窗 -->
      <el-dialog title="采购订单" :visible.sync="PurOrderDialog" :modal-append-to-body="false">
        <el-input
          placeholder="请输入关键字查询"
          style="width:200px;margin-bottom:10px;"
          icon="search"
          v-model="name1"
          :on-icon-click="handleIconClick">
        </el-input>
        <el-table 
          border
          tooltip-effect="dark"
          :data="PurOrderList"
          highlight-current-row>
          <el-table-column property="A" label="单据日期" width="200"></el-table-column>
          <el-table-column property="B" label="单据编号" width="200"></el-table-column>
          <el-table-column property="C" label="单据名称" width="200"></el-table-column>
          <el-table-column property="D" label="备注"></el-table-column>
        </el-table>
        <div slot="footer" class="dialog-footer cover">
          <el-button size="small" @click="PurOrderDialog = false">取 消</el-button>
          <el-button size="small" @click="Determine">确 定</el-button>
        </div>
      </el-dialog>
      <!-- 存货查询窗口 -->
      <el-dialog title="存货" :visible.sync="StockDialog" :modal-append-to-body="false">
        <el-input
          placeholder="请输入关键字查询"
          style="width:200px;margin-bottom:10px;"
          icon="search"
          v-model="name1"
          :on-icon-click="handleIconClick">
        </el-input>
        <el-table 
          border
          tooltip-effect="dark"
          :data="StockList"
          @selection-change="handleSelectionSale"
          style="width:100%">
          <el-table-column type="selection" width="55"></el-table-column>
          <el-table-column property="A" label="存货编码" width="150" sortable></el-table-column>
          <el-table-column property="B" label="存货名称" width="150" show-overflow-tooltip></el-table-column>
          <el-table-column property="C" label="规格型号" show-overflow-tooltip></el-table-column>
          <el-table-column property="D" label="计量单位" width="120"></el-table-column>
          <el-table-column property="E" label="库存数量" width="120" sortable></el-table-column>
        </el-table>
        <div slot="footer" class="dialog-footer cover">
          <el-button size="small" @click="StockDialog = false">取 消</el-button>
          <el-button size="small" @click="Determine">确 定</el-button>
        </div>
      </el-dialog>
      <!-- 流程图 -->
      <el-dialog title="流程执行情况" :visible.sync="checkflowRowVisible" :modal-append-to-body="false" align="center">
        <el-table border :data="docRowView" min-height="300" header-align="center" v-loading="docViewloading" element-loading-text="拼命刷新中...">
          <el-table-column property="PlanUser" label="操作人"></el-table-column>
          <el-table-column property="StepName" label="步骤名称"></el-table-column>
          <el-table-column property="OpDate" label="时间"></el-table-column>
          <el-table-column property="OpRemark" label="备注"></el-table-column>
        </el-table>
      </el-dialog>
      <!-- 导出询问框 -->
      <el-dialog title="请选择导出的内容" :visible.sync="ExportDialog" :modal-append-to-body="false" size="tiny">
        <el-radio-group v-model="radioExport">
          <el-radio :label="1">导出模板</el-radio>
          <el-radio :label="2">导出订单明细</el-radio>
        </el-radio-group>
        <div slot="footer" class="dialog-footer cover">
          <el-button size="small" @click="Cancel">取 消</el-button>
          <el-button size="small" @click="Determine">确 定</el-button>
        </div>
      </el-dialog>
      <!-- 打印窗口 -->
			<el-dialog :visible.sync="dialogPrintVisible" :modal-append-to-body="false">
				<div class="printBox cover">
					<el-button size="small" class="center" @click.native="printPdf()">&#12288;打印&#12288;</el-button>
					<div id="form1">
            <table width="100%" border="0" v-loading="printLoading" element-loading-text="正在加载中">
              <caption>
                <h3 id="Doc">采购入仓单</h3>
              </caption>
              <thead>
                <tr>
                  <td style="padding:5px 0;line-height:30px;">
                    <div style="float:left;width:33.33%;">销售订单：XXXXXX</div>
                    <div style="float:left;width:33.33%;text-align:center;">日期：XXXXXX</div>
                    <div style="float:right;width:33.33%;text-align:right;">单号：XXXXXX</div>
                  </td>
                </tr>
                <tr>
                  <td style="padding:5px 0;line-height:30px;">
                    <div style="float:left;width:33.33%;">供应商：XXXXXX</div>
                    <div style="float:right;width:33.33%;text-align:right;">结算方式：XXXXXX</div>
                  </td>
                </tr>
              </thead>
              <tbody>
                <tr>
                  <td>
                    <div id="Line" class="table-c">
                      <table width="100%" class="ListTable">
                        <thead>
                          <tr>
                            <td>存货编号</td>
                            <td>存货名称</td>
                            <td>规格型号</td>
                            <td>单位</td>
                            <td>采购数量</td>
                            <td>备注</td>
                          </tr>
                        </thead>
                        <tbody>
                          <tr>
                            <td>YF0015</td>
                            <td style="text-align:left;">直流电机</td>
                            <td></td>
                            <td></td>
                            <td>4</td>
                            <td></td>
                          </tr>
                          <tr>
                            <td>YF0015</td>
                            <td style="text-align:left;">直流电机</td>
                            <td></td>
                            <td></td>
                            <td>4</td>
                            <td></td>
                          </tr>
                          <tr>
                            <td>YF0015</td>
                            <td style="text-align:left;">直流电机</td>
                            <td></td>
                            <td></td>
                            <td>4</td>
                            <td></td>
                          </tr>
                        </tbody>
                      </table>
                    </div>
                  </td>
                </tr>
                <tr>
                  <td style="padding:5px 0;line-height:30px;">
                    <div style="float:left;width:25%;">审核人：XXXXXX</div>
                    <div style="float:left;width:25%;text-align:center;">仓库：XXXXXX</div>
                    <div style="float:left;width:25%;text-align:center;">部门主管：XXXXXX</div>
                    <div style="float:right;width:25%;text-align:right;">制单人：XXXXXX</div>
                  </td>
                </tr>
              </tbody>
            </table>
					</div>
				</div>
			</el-dialog>

  </section>
</template>
<script>
  export default {
    name: "BOMPurchaseOrder",
    data() {
      return {
        gray: false,
        loading: true, //显示列表loading
        dialogSearchVisible:false,//查询窗口
        docViewloading:false,//流程图
        isShowRadio:false,
        formLabelWidth:'90px',
        SaleOrderDialog:false,
        PurOrderDialog:false,
        isshowList:true,//列表
        isshowIn:false,//BOM
        checked:false,
        multipleSelection: [],
        multipleSelectSale: [],
        radioExport:1,
        ExportDialog:false,//询问窗口
        inRadio:'',
        Settlement:[{
          value:"1",
          label:"入仓单结算",
        },{
          value:"2",
          label:"发票结算",
        }],//结算方式
        settle:'',
        StockList:[{
          A:'10001',
          B:'600ML脉动饮料',
          C:'600ML/一瓶',
          D:'瓶',
          E:1920
        },{
          A:'10001',
          B:'600ML脉动饮料',
          C:'600ML/一瓶',
          D:'瓶',
          E:1920
        },{
          A:'10001',
          B:'600ML脉动饮料',
          C:'600ML/一瓶',
          D:'瓶',
          E:1920
        }],
        StockDialog:false,//存货查询窗口
        checkflowRowVisible:false,
        docRowView:[{
          PlanUser:"杨晓莉",
          StepName:"提交",
          OpDate:"2018/1/25 16:25:55",
          OpRemark:""
        },{
          PlanUser:"杨晓莉",
          StepName:"提交",
          OpDate:"2018/1/25 16:25:55",
          OpRemark:""
        },{
          PlanUser:"杨晓莉",
          StepName:"提交",
          OpDate:"2018/1/25 16:25:55",
          OpRemark:""
        },{
          PlanUser:"杨晓莉",
          StepName:"提交",
          OpDate:"2018/1/25 16:25:55",
          OpRemark:""
        }],
        inStatus:'',//订单入库 还是 非订单入库
        dialogPrintVisible:false,
        printLoading:false,
        InWarehousingDetail:[{
          A:"YF0015",
          B:"直流电机",
          C:100,
          D:100,
          E:400,
          F:1980,
          G:1920,
        },{
          A:"YF0015",
          B:"直流电机",
          C:100,
          D:100,
          E:400,
          F:1980,
          G:1920,
        },{
          A:"YF0015",
          B:"直流电机",
          C:100,
          D:100,
          E:400,
          F:1980,
          G:1920,
        }
        ],
        tableData:[{
          A:'YF0015',
          B:'直流电机',
          C:0,
          D:4,
          E:4,
          F:34.25,
          G:34.25,
          H:"0.00%",
          I:34.25,
          J:137.00,
          K:137.00,
          L:"2018-03-01"
        },{
          A:'YF0015',
          B:'直流电机',
          C:0,
          D:4,
          E:4,
          F:34.25,
          G:34.25,
          H:"0.00%",
          I:34.25,
          J:137.00,
          K:137.00,
          L:"2018-03-01"
        },{
          A:'YF0015',
          B:'直流电机',
          C:0,
          D:4,
          E:4,
          F:34.25,
          G:34.25,
          H:"0.00%",
          I:34.25,
          J:137.00,
          K:137.00,
          L:"2018-03-01"
        },{
          A:'YF0015',
          B:'直流电机',
          C:0,
          D:4,
          E:4,
          F:34.25,
          G:34.25,
          H:"0.00%",
          I:34.25,
          J:137.00,
          K:137.00,
          L:"2018-03-01"
        },{
          A:'YF0015',
          B:'直流电机',
          C:0,
          D:4,
          E:4,
          F:34.25,
          G:34.25,
          H:"0.00%",
          I:34.25,
          J:137.00,
          K:137.00,
          L:"2018-03-01"
        },{
          A:'YF0015',
          B:'直流电机',
          C:0,
          D:4,
          E:4,
          F:34.25,
          G:34.25,
          H:"0.00%",
          I:34.25,
          J:137.00,
          K:137.00,
          L:"2018-03-01"
        }],
        PurOrderList:[{
          A: "2018-03-03",
          B: "FG18030019",
          C: "非BOM采购",
          D: ""
        },{
          A: "2018-03-03",
          B: "FG18030019",
          C: "非BOM采购",
          D: ""
        },{
          A: "2018-03-03",
          B: "FG18030019",
          C: "非BOM采购",
          D: ""
        },{
          A: "2018-03-03",
          B: "FG18030019",
          C: "非BOM采购",
          D: ""
        }],
        DocNo:'1',
        DocDate:'',
        name1:'',
        input2:'',
        Names:[{
          label:'1',
          value:"1"
        },{
          label:'1',
          value:"2"
        }],
        Searchform:{
          StartMoney:'',
          EndMoney:'',
          StartDate:'',
          EndDate:'',
          DocNo:'',
          Title:'',
          DocStatus:''
        },
        options:[{
          value: '1',
          label: '黄金糕'
        },{
          value: '2',
          label: '双皮奶'
        }],
        options2:[{
          value: '1',
          label: '黄金糕'
        },{
          value: '2',
          label: '双皮奶'
        }],
        dataList:[{
          A: '2016-05-03',
          B: 'CR18010001',
          C: '订单入仓',
          D: '材料仓',
          E: 'BG18010005',
          F: 'true',
          G: '广州品冠电子有限公司',
          H: '待审核'
        }, {
          A: '2016-05-03',
          B: 'CR18010001',
          C: '订单入仓',
          D: '材料仓',
          E: 'BG18010005',
          F: 'true',
          G: '广州品冠电子有限公司',
          H: '待审核'
        }, {
          A: '2016-05-03',
          B: 'CR18010001',
          C: '订单入仓',
          D: '材料仓',
          E: 'BG18010005',
          F: 'true',
          G: '广州品冠电子有限公司',
          H: '待审核'
        }, {
          A: '2016-05-03',
          B: 'CR18010001',
          C: '订单入仓',
          D: '材料仓',
          E: 'BG18010005',
          F: 'true',
          G: '广州品冠电子有限公司',
          H: '待审核'
        }],
        loading:false,
        inputIndex:0,
        isshowSettle:true
      }
    },
    methods:{
      fpCheck(event){
        let checkTests = document.getElementsByClassName('testCheckBox')
        console.log(checkTests)
        console.log(event.currentTarget.checked);
         for(let i = 0 ; i < checkTests.length ; i++){
           console.log(checkTests);
           if(event.currentTarget.checked){
              checkTests[i].children[0].className += " is-checked";
           }else{
             checkTests[i].children[0].className = checkTests[i].children[0].className.split('is-checked')[0]
           }
        }
        
      },
      nextinput(event){
        let ips = document.querySelectorAll("input[type=text]");
        console.log(event.currentTarget,'event.currentTarget');
        console.log(ips,'ips');
        console.log(event.currentTarget)
        console.log(event.currentTarget.children[0].value,'event.currentTarget.children[0].value');
        if(event.currentTarget.children[1] && event.currentTarget.children[1].tagName=='INPUT'){
          let epps = document.getElementsByClassName('el-picker-panel');
          let tempepps = Object.keys(epps);
          console.log(tempepps,'tempepps');
          tempepps.forEach((item,index)=>{
            epps[index].style.display = 'none';
          })
          ips[this.inputIndex+1].focus();
          ips[this.inputIndex+1].style.cssText="border:1px solid #20a0ff;border-radius:4px !important;";
          ips[this.inputIndex+1].parentNode.parentNode.style.padding = "0px";
          ips[this.inputIndex].style.border = "0px solid #20a0ff";
          return;
        }
        let inputs = Object.keys(ips);
        inputs.forEach((item,index)=>{
          if(index==(inputs.length-1)){
            }else if(event.currentTarget.children[0] == ips[index]){
              console.log(index);
              this.inputIndex = index+1;
              ips[index+1].focus();
              ips[index+1].style.cssText="border:1px solid #20a0ff;border-radius:4px !important;";
              ips[index+1].parentNode.parentNode.style.padding = "0px";
              ips[index].style.border = "0px solid #20a0ff";
            }
        })
      },
      
      logTimeChange(val){
      },
      //点击导出时弹出询问框
      handleExport(){
        this.ExportDialog = true;
      },
      Determine(){
        this.ExportDialog = false;
        console.log(this.radioExport,'this.radioExport');
      },
      Stock(index,inStatus){
        if(inStatus==true){
          return;
        }
        this.StockDialog = true;
      },
      changeRadio(e){
        if(e==1){
          this.inStatus = true;
          console.log('订单入仓');
        }else{
          this.inStatus = false;
          console.log('非订单入仓');
        }
      },
      jump(index) {
        if (this.$refs[index + 1]) {
          this.$refs[index + 1][0].$el.getElementsByTagName('input')[0].focus();
        }
      },
      search(){
        this.dialogSearchVisible = true;
      },
      async Query(){
        this.dialogSearchVisible = false;
      },
      settleChange(e){
        e=="1" ? this.isshowSettle = false : this.isshowSettle = true;
      },
      //重置
      Reset(){
        this.Searchform = {
          StartMoney:'',
          EndMoney:'',
          StartDate:'',
          EndDate:'',
          DocNo:'',
          Title:'',
          DocStatus:''
        }
      },
      handleCurrentChange(val){
        this.currentRow = val;
        console.log(this.currentRow,'this.currentRow');
      },
      //销售订单列表
      handleSelectionSale(val){
        this.multipleSelectSale = val;
      },
      //弹框取消按钮
      Cancel(){
        this.ExportDialog = false;
      },
      //打印
      printPdf(){
        $("#form1").jqprint({
          debug: false,
          importCSS: true,
          printContainer: false,
          operaSupport: false
        });
      },
      //销售订单确定按钮
      Determine(){
        let arr = '';
        this.multipleSelectSale.map(item=>{
          arr = item.name;
        })
        console.log(arr,'arr');
      },
      handleIn(index,row){
        this.isshowIn = true;
        this.isshowList = false;
        this.inStatus = '';
        this.inRadio = '';
        if(this.isUndefined(row)){
          console.log('新建');
          this.$router.push({
            path:'/PurchaseWarehouseOrders',
            query:{
              News:true,
            }
          })
          this.isShowRadio = true;
        }else{
          console.log('修改');
          this.$router.push({
            path: '/PurchaseWarehouseOrders',
            query:{
              Edit:true,
            }
          })
        }
      },
      // 新建返回到列表页面
      ToBack() {
        this.isshowList = true;
        this.isshowIn = false;
        this.$router.push({
          path: '/PurchaseWarehouseOrders',
        })
        this.InWarehousingDetail = [{
          A:"YF0015",
          B:"直流电机",
          C:100,
          D:100,
          E:400,
          F:1980,
          G:1920,
        }]
      },
      handleIconClick(){
      },
      //保存
      Save(){},
      //提交
      Submit(){},
      //采购订单按钮
      PurOrderQuery(ev) {
        this.PurOrderDialog = true;
        console.log(ev, "ev");
      },
      handleDel(index,row){
        this.$confirm("确认删除该记录吗?", "提示", {
          type: "warning"
        }).then(() => {
          this.$message({
            type: "success",
            message: "删除成功",
          });
        })
      },
      generate(){
        this.$confirm("确认要生成采购进货单吗?", "提示", {
          type: "warning"
        }).then(() => {
          this.$message({
            type: "success",
            message: "生成成功",
          });
        })
      },
      //流程图
      checkflowRow(){
        this.checkflowRowVisible = true;
      },
      inputFocus(e) {
        console.log(e);
        e.target.style = "border: 2px red solid ";
      },
      inputBlur(e) {
        console.log(e);
        e.target.style = "border: 2px transparent solid ";
      },
      nextinput(event, index) {
        let i = index.split("-");
        let s ; 
        if (i[1] == "2") {
          s = `input${Number(i[0]) + 1}-1`;
          console.log(s, "s")
        } else {
          s = `input${i[0]}-2`;
        }
        document.getElementsByClassName(s)[0] && document.getElementsByClassName(s)[0].getElementsByClassName('el-input__inner')[0].focus();
      },
      addInRow(index){
        const item = {
          A:"",
          B:"",
          C:0,
          D:0,
          E:0,
          F:0,
          G:0,
          H:"",
          I:0,
          J:0,
          K:0,
          L:0,
          M:"2018-03-01"
        }
        this.InWarehousingDetail.splice(index+1,0,item)
      },
      handlePrint(){
        this.dialogPrintVisible = true
      },
      //入仓明细删除事件
      deleInRow(index){
        this.$confirm("确认删除该记录吗?", "提示", {
          type: "warning"
        }).then(() => {
          this.InWarehousingDetail.splice(index, 1);
          this.$message({
            message: "已删除",
            type: "success"
          });
        });
      },
      // 撤销
      repeal(index, row) {
        this.$confirm("确认撤销吗?", "提示", {
          type: "warning"
        }).then(() => {
          this.$message({
            type: "success",
            message: "撤销成功"
          });
        });
      },
    },
    created(){
      const query = this.$route.query;
      console.log(query,'query');
      if(query.News && query.News=='true'){
        this.isshowIn = true;
        this.isshowList = false;
      }else if(query.InYes && query.InYes==true){
        console.log('订单入仓');
        console.log(query,'query');
        this.inStatus = true;
        this.inRadio = '—订单入仓';
        this.isshowIn = true;
        this.isshowList = false;
        this.isShowRadio = true;
      }else if(query.InNot && query.InNot==true){
        console.log(`非订单入仓`);
        this.inStatus = false;
        this.inRadio = '—非订单入仓';
        this.isshowIn = true;
        this.isshowList = false;
        this.isShowRadio = true;
      }else{
        this.isshowIn = false;
        this.isshowList = true;
      }
    },
    mounted(){
        
    },
    computed:{
      //采购金额 合计
      PurAmountCompute(){
        let sum = 0;
        this.InWarehousingDetail.forEach(item=>{
          sum += Number(item.G);
        })
        return sum;
      },
      InRadioComputed(){
        if(this.inRadio === 1){
          return '—订单入仓'
        }else if(this.inRadio === 2){
          return '—非订单入仓'
        }else if(this.inRadio === '') {
          return  ''
        }else{
          return this.inRadio;
        }
      }
    }
  }
</script>
<style scoped lang="scss">
@import "../../../common/css/index.css";
.toolbar h2 {
  line-height: 36px;
  margin: 0 10px 0 0;
}
.toolbar .title {
  display: inline-flex;
  line-height: 5px;
  width: 100%;
  justify-content: space-between;
}
.main-left{
  padding:1vw 1vw;
}
.main-left h3{
  height: 20px;
  line-height: 20px;
  margin-bottom: 10px;
}
.left-form,.right-form{
  display: flex;
  justify-content: center;
  align-items: center;
}
.gray{
  background: #eee !important;
}
.el-table .cell{
  padding:0 0;
}
.common-icon{
  line-height:24px;
  float:none
}

</style>

